#!/bin/sh
#PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/opt/local/bin:$HOME/bin
#echo $PATH

# 变量
REMOTE="root@172.16.1.166:/usr/local/src/"
SRC="/usr/local/src/"

#OS=`uname -s`

# 同步函数
sync_sproot() {
    EXCLUDES=""
    rsync -vr -e "ssh -p 22" ${EXCLUDES} ${SRC} ${REMOTE}
}


# 检查参数
if [ -z "$1" ]; then
    echo "Usage: $0 [ht]"
    exit 1;
fi

# 开始执行
for i in $*
do
    case "$i" in
    'ht')
        SRC_EXCLUDES=""
        sync_sproot "${SRC}" "${SRC_EXCLUDES}"
        ;;
    *)
    echo "no such node"
    esac
done
